package cn.sm1234.serverlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

// 访问的时候，大小写敏感
@WebServlet(name="helloServlet", urlPatterns = "/helloServlet")  // @WebServlet:声明该类为Servlet程序
/*
* 等同于web.xml配置
*    <servlet>
*        <servlet-name>helloServlet</servlet-name>
*        <serverlet-class>cn.sm1234.servlet.Helloservlet</servelet-class>
*    </servlet>
*    <servlet-mapping>
*        <servlet-name>helloServlet</servlet-name>
*        <url-pattern>/helloServlet</url-partten>
*    </serlet-mapping>
* */
public class HelloServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("执行了HelloServlet的doGet");
        super.doGet(req, resp);
    }
}
